{% extends 'admin/layout.html.twig' %}

{% set menu = 'admin_setting_mobile_iap_product_list' %}

{% set script_controller = 'setting/mobile-iap-product' %}


{% block main %}
{{ web_macro.flash_messages() }}
<form class="form-inline" method="post">
  <div class="form-group">
    <label class="sr-only" for="product">{{'admin.iap_product.id'|trans}}</label>
    <input class="form-control" id="product" name="productId" placeholder="{{'admin.iap_product.id_tips'|trans}}">
  </div>
  <div class="form-group">
    <label class="sr-only" for="title">{{'admin.iap_product.name'|trans}}</label>
    <input class="form-control" id="title" name="title" placeholder="{{'admin.iap_product.name_tips'|trans}}">
  </div>
  <div class="form-group">
    <label class="sr-only" for="price">{{'admin.iap_product.price'|trans}}</label>
    <input class="form-control" id="price" name="price" placeholder="{{'admin.iap_product.price_tips'|trans}}">
  </div>
  <input type="hidden" name="_csrf_token" value="{{ csrf_token('site') }}">
  <button type="submit" class="btn btn-primary">{{'admin.iap_product.add_btn'|trans}}</button>
</form>

<table class="table table-striped table-hover" id="iap-product-table" style="word-break:break-all;">
    <thead>
    <tr>
      <th>{{'admin.iap_product.id'|trans}}</th>
      <th width="40%">{{'admin.iap_product.name'|trans}}</th>
      <th>{{'admin.iap_product.price'|trans}}</th>
      <th>{{'admin.iap_product.operation'|trans}}</th>
    </tr>
    </thead>
    <tbody>
    {% for product in products %}
      <tr>
        <td>{{ product.productId }}</td>
        <th width="30%">{{ product.title }}</td>
        <td>{{ product.price }}</td>
        <td>
          <a class="btn btn-default btn-sm" data-role="delete" data-url="{{url('admin_setting_mobile_iap_product_delete',{productId:product.productId})}}">{{'form.btn.delete'|trans}}</a>
        </td>
      </tr>
    {% else %}
      <tr>
        <td colspan="20">
          <div class="empty">{{'admin.iap_product.empty'|trans}}</div>
        </td>
      </tr>
    {% endfor %}
    </tbody>
  </table>

{% endblock %}
